package data_base;

import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DataConnection {

	public static Connection openConection() {

		try {
			// carga de los drivers
			Class.forName("org.sqlite.JDBC");
			// apertura de la conexion
			File dataBase = new File("src/data_base/baseDeDatos.s3db");
			Connection conn = DriverManager.getConnection("jdbc:sqlite:"
					+ dataBase.getAbsolutePath());
			if (conn != null) {
				System.out.println("conexion establecida");
			}
			// devuelve la conexion
			return conn;
		} catch (ClassNotFoundException e) {
			System.out.println(" you may have enter a correct destination");
			e.printStackTrace();
		} catch (SQLException e) {

			e.printStackTrace();
		} finally {

		}
		return null;

	}

	public static void main(String[] args) {
		openConection();
	}
}
